package com.chensheng.util;

import com.chensheng.enums.CodeEnum;
import com.chensheng.enums.OrderStatusEnum;

/**
 * @Author:ChenSheng
 * @Description:
 * @Date: Created in 上午 7:08 2018/5/18 0018
 */
public class EnumUtil {

    public static <T extends CodeEnum> T getByCode(Integer code, Class<T> enumClass){
        for(T each : enumClass.getEnumConstants()){
            if(code.equals(each.getCode())){
                return each;
            }
        }
        return null;
    }
}
